/*
 * @Description:: 请补充填写
 * @Version: 请配置版本号
 * @Author: 小白stweet
 * @Date: 2020-06-03 08:12:33
 * @LastEditors: smallWhite
 * @LastEditTime: 2024-08-27 08:36:47
 * @FilePath: /huizhou_website/src/router.js
 */ 
import Vue from 'vue'
import store from './store'
import Router from 'vue-router'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import Index from './views/home/index.vue'
NProgress.configure({
  easing: 'ease',  // 动画方式
  speed: 800,  // 递增进度条的速度
  showSpinner: false, // 是否显示加载ico
  trickleSpeed: 200, // 自动递增间隔
  minimum: 0.5 // 初始化时的最小百分比
})
Vue.use(Router)

const router = new Router({
  routes: [
    {
      path:'/', 
      component: Index, 
      name: 'index',
      meta: {title: '惠州市城市建设投资集团有限公司-首页'},
    },
    {
    path:'/', 
    component: () => import("./views/main"),
    name: '/',
    children:[
      {
        path:'/company_profile', 
        component: () => import("./views/about_us/about_us"), 
        name: 'company_profile',
        children:[
          {
            path:'/company_profile', 
            component: () => import("./views/about_us/components/company_profile"), 
            name: 'company_profile',
            meta: {title: '集团简介'},
          },
          {
            path:'/organizational', 
            component: () => import("./views/about_us/components/organizational"), 
            name: 'organizational',
            meta: {title: '组织结构'},
          },
          {
            path:'/department', 
            component: () => import("./views/about_us/components/department"), 
            name: 'department',
            meta: {title: '部门职责'},
          }
        ]
      },
      {
        path:'/news', 
        component: () => import("./views/news/index"), 
        name: 'news',
        children:[
          {
            path:'/company_news', 
            component: () => import("./views/news/components/company_news.vue"), 
            name: 'company_news',
            meta: {title: '集团新闻'},
          },
          {
            path:'/industry_news', 
            component: () => import("./views/news/components/industry_news"), 
            name: 'industry_news',
            meta: {title: '基层动态'},
          },
          {
            path:'/safe_production', 
            component: () => import("./views/news/components/safe_production"), 
            name: 'safe_production',
            meta: {title: '安全生产'},
          },
          {
            path:'/news_details', 
            component: () => import("./views/news/components/details"), 
            name: 'news_details',
            meta: {title: '新闻详情'},
          }
        ]
      },
      {
        path:'/information', 
        component: () => import("./views/information/index"), 
        name: 'information',
        children:[
          {
            path:'/notice', 
            component: () => import("./views/information/components/notice.vue"), 
            name: 'notice',
            meta: {title: '公告公示'},
          },
          {
            path:'/information_details', 
            component: () => import("./views/information/components/details"), 
            name: 'information_details',
            meta: {title: '公告详情'},
          },
          {
            path:'/leaderjob', 
            component: () => import("./views/information/components/leaderjob.vue"), 
            name: 'leaderjob',
            meta: {title: '干部管理'},
          },
          {
            path:'/recruitment', 
            component: () => import("./views/information/components/recruitment"), 
            name: 'industry_news',
            meta: {title: '人才招聘'},
          },
          {
            path:'/detailsjob', 
            component: () => import("./views/information/components/detailsjob"), 
            name: 'detailsjob',
            meta: {title: '干部详情'},
          },{
            path:'/recruitmentdetails', 
            component: () => import("./views/information/components/recruitmentdetails"), 
            name: 'recruitmentdetails',
            meta: {title: '招聘详情'},
          }
        ]
      },
      {
        path:'/party', 
        component: () => import("./views/party/index"), 
        name: 'party',
        children:[
          {
            path:'/party_building', 
            component: () => import("./views/party/components/party_building.vue"), 
            name: 'party_building',
            meta: {title: '党的建设'},
          },
          {
            path:'/party_job', 
            component: () => import("./views/party/components/party_job.vue"), 
            name: 'party_job',
            meta: {title: '群团工作'},
          },{
            path:'/parth_builds', 
            component: () => import("./views/party/components/parth_builds.vue"), 
            name: 'parth_builds',
            meta: {title: '党风廉政建设'},
          },
          
          {
            path:'/party_details', 
            component: () => import("./views/party/components/details"), 
            name: 'party_details',
            meta: {title: '详情'},
          }
        ]
      },
      
      {
        path:'/project', 
        component: () => import("./views/project/index"), 
        name: 'project',
        children:[
          {
            path:'/project_index', 
            component: () => import("./views/project/components/project_index.vue"), 
            name: 'project_index',
            meta: {title: '城市开发建设'},
          },
          {
            path:'/project_index_a', 
            component: () => import("./views/project/components/project_index_a.vue"), 
            name: 'project_index_a',
            meta: {title: '城市服务'},
          },
          {
            path:'/project_index_b', 
            component: () => import("./views/project/components/project_index_b.vue"), 
            name: 'project_index_b',
            meta: {title: '城市运营'},
          }
        ]
      }
      
    ]
  },
    { path: '*', redirect: '/' }
  ],
  mode: 'history'
})
router.beforeEach((to,from,next) => {
  
  if(from.name === null && to.name === 'index'){
    store.commit('setOpenNav', [0,0])
    NProgress.start();
    next()
  }else{
    NProgress.start();
    next()
  }
})
router.afterEach(() => {
  // 在即将进入新的页面组件前，关闭掉进度条
  NProgress.done()
})
const routerPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return routerPush.call(this, location).catch(error => error)
}

export default router